{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 伯努利分布"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 伯努利分布"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "考虑二元随机变量 $x\\in \\{0,1\\}$（抛硬币，正面为 1，反面为 0），其概率分布由参数 $\\mu$ 决定：\n",
    "\n",
    "$$\n",
    "p(x=1)=\\mu\n",
    "$$\n",
    "\n",
    "其中 $(0 \\leq\\mu \\leq 1)$，并且有 $p(x=0)=1-\\mu$。这就是伯努利分布（`Bernoulli distribution`），其概率分布可以写成：\n",
    "\n",
    "$$\n",
    "\\text{Bern}(x|\\mu) = \\mu^{x}(1-\\mu)^{1-x}\n",
    "$$\n",
    "\n",
    "均值和方差为：\n",
    "\n",
    "$$\n",
    "\\begin{align}\n",
    "\\mathbb E[x] & = \\mu \\\\\n",
    "\\text{var}[x] & = \\mu(1-\\mu)\n",
    "\\end{align}\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 伯努利分布的最大似然估计"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "考虑一组 $x$ 的观测数据 $\\mathcal D = \\{x_1, \\dots, x_N\\}$，在独立同分布的假设下，其似然函数为\n",
    "\n",
    "$$\n",
    "p(\\mathcal D|\\mu) = \\prod_{n=1}^N p(x_n|\\mu) = \\prod_{n=1}^N \\mu^{x_n}(1-\\mu)^{1-x_n}\n",
    "$$\n",
    "\n",
    "对数似然为\n",
    "\n",
    "$$\n",
    "\\ln p(\\mathcal D|\\mu) = \\sum_{n=1}^N \\ln p(x_n|\\mu) \n",
    "= \\sum_{n=1}^N \\left\\{x_n\\ln \\mu + (1-x_n)\\ln (1-\\mu)\\right\\}\n",
    "$$\n",
    "\n",
    "对数似然值只依赖于 $\\sum_{n=1}^N x_n$ 的取值，而事实上 $\\sum_{n=1}^N x_i$ 就是伯努利分布的一个充分统计量，它可以提供参数 $\\mu$ 的全部信息。\n",
    "\n",
    "对 $\\mu$ 最大化对数似然，我们很容易得到\n",
    "\n",
    "$$\n",
    "\\mu_{ML} = \\frac 1 N \\sum_{n=1}^N {x_n}\n",
    "$$\n",
    "\n",
    "即最大似然估计值为样本均值（`sample mean`），若样本中 $x=1$ 的数目为 $m$ 则：\n",
    "\n",
    "$$\n",
    "\\mu_{ML} = \\frac{m}{N}\n",
    "$$\n",
    "\n",
    "考虑抛三次硬币出现了三次正面的情况，此时 $N=m=3, \\mu_{ML} = 1$。在这种情况下，最大似然估计会得到每次都是正面的结果，这显然违背了我们的正常认知。事实上，这是一种过拟合的典型表现。\n",
    "\n",
    "为了解决这个问题，我们可以考虑引入先验知识。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 二项分布"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "给定数据总数 $N$，$x=1$ 的总次数 $m$ 满足一定的分布，这个分布叫做二项分布（`binomial distribution`），当$N=1$时变为伯努力分布。\n",
    "\n",
    "从伯努利分布的似然函数中可以看出它应该正比于 $\\mu^{m}(1-\\mu)^{N-m}$，事实上它可以写成：\n",
    "\n",
    "$$\n",
    "\\text{Bin}(m~|~N,\\mu) = \\begin{pmatrix} N \\\\m \\end{pmatrix} \\mu^{m}(1-\\mu)^{N-m}\n",
    "$$\n",
    "\n",
    "其中\n",
    "\n",
    "$$\n",
    "\\begin{pmatrix} N \\\\m \\end{pmatrix} \\equiv \\frac{N!}{(N-m)!m!}\n",
    "$$\n",
    "\n",
    "是组合数。\n",
    "\n",
    "验证它是一个概率分布，二项式定理给出：\n",
    "\n",
    "$$\n",
    "\\sum_{m=0}^N \\begin{pmatrix} N \\\\m \\end{pmatrix} \\mu^{m}(1-\\mu)^{N-m} = (\\mu + 1 - \\mu)^N = 1\n",
    "$$\n",
    "\n",
    "下图是 $N = 10, \\mu=0.25$ 的分布的一个直方图示意。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAW8AAAEgCAYAAAB7MvKtAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAE01JREFUeJzt3X+07XVd5/Hni3tBQPyBWqBwjVQULEnUgFFv3hTzaina\n1OCvsHSZM0ljK0eJGUauuVyBLrNmWCklFv6CyknCMRVNT2kJAQpIXkxQpgsp/koNy7pX3vPH93to\ne7jn7PNj7+8+n3uej7XOuvv73Z/zfb/3uWe99vd89vdHqgpJUlv2m3UDkqSVM7wlqUGGtyQ1yPCW\npAYZ3pLUIMNbkhpkeEtSgwxvSWqQ4a0mJTkoyZuTbF2wfkuS85O8NMlbkhw1mw5X1kuSByc5J8lv\nJ/lQkkcveP4VSV6e5CFJnpTkD6fdv9a3zbNuQFqpJC8BHgT8DPCuBU+/HTirqj6e5CTgIuA/DNzi\ninpJsh/wcuClVVVJfg64LMnDquqr/bC7A68CXg/8PfAfB3kFWrfc89ZEJblbkv+Z5NYkO5Nk5Lnn\nJrkhyXuTPGu1Narq/Ko6A/inBbUfCvxIVX28H3c58LAkP7DaWqu1wl6OBh4LPKBfvogurJ85MqaA\nHwJOBB5cVVdPq3e1wfDWRFXVvwKvo9vrPIKRAKqqdwEXVtXTq+o9Uyh/HLBrwbpb6IJxaCvp5Xbg\nSOD+AFW1p1936OigqtpZVVdW1Xcn365a47SJpmEr8KfAAcArgNGgvmOKdb8f+JcF6/4ZOGyKNdfc\nS1XdCtxvfjnJFuA+wCdGxyV5MRDgeOAPquqKCfeshhjemoYfBc6h29O8KcnWqvpYkmOAz44OTHJv\n4DfpQmkpb6yq68aMORT4twXr/g24x1LflOQ04GFV9T/65RcDh1fVa9bQ56p66b0UeN/8lEvv/wLX\nV9W/9uF+RZKHVtXty9ie9kGGt6ZhU3XXGt6V5CLglcDHgB8H3jk6sKq+AbxwQnX/aS/rDga+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Or6gNTrnt/\n4MIk+9G9qb+9qv58yjX3ZsipssOA9/QXONoMvLOqLhuo9i8D7+x3Sm5iwJPb+jeqk4Gh5vipqmv7\nv6iuopu2+CTwuwOVf3eS+9J9YPpLVfWtaRUayY77zWcHcA7wR0leBNwM/KeJ1OoPX5EkNWS9T5tI\nkvbC8JakBhnektQgw1uSGmR4S1KDDG9JapDhLUkNMrwlqUGGtyQ1yPCWpAYZ3pLUoHV9YSppkpIc\nRnflwicCr6W7RRbAU+iu+fwIuh2ap1TVs2fSpLRMXphKG0aS/wK8Gfg7uvsIXtCv/zLw8qp6e798\nG/BDVfXVmTUrjWF4a8Po7x15T+DKqpq/OP4WupsSzF/z+UF0Nw04fHadSuM5560No79D0Ml0dxCf\n9+QFy88HLkpyYJK7DdmftBKGtzaahWF9Mt39DeedCrwDeBGw/4B9SStieGujeQjdnZkWW76a7n6S\nNw1142dpNZzzlqQGuectSQ0yvCWpQYa3JDXI8JakBhnektQgw1uSGmR4S1KDDG9JapDhLUkN+v+f\nQhSzz2scsAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f4ad2a50310>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import scipy as sp\n",
    "\n",
    "%matplotlib inline\n",
    "\n",
    "from scipy.stats import binom\n",
    "\n",
    "n = 10\n",
    "mu = 0.25\n",
    "\n",
    "yy = binom.rvs(n, mu, size=1000)\n",
    "\n",
    "fig, ax = plt.subplots()\n",
    "\n",
    "ax.hist(yy, bins=range(11), normed=True, rwidth=0.8)\n",
    "\n",
    "ax.set_xlabel(\"$m$\", fontsize='x-large')\n",
    "\n",
    "ax.set_xlim(0, 11)\n",
    "\n",
    "ax.set_yticks(np.arange(0, 0.31, 0.1))\n",
    "\n",
    "ax.set_xticks(np.arange(0.5, 10.6, 1))\n",
    "ax.set_xticklabels(range(11))\n",
    "\n",
    "ax.set_title(r'$N = 10, \\mu=0.25$', fontsize='x-large')\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "其均值和方差分别为：\n",
    "\n",
    "$$\n",
    "\\begin{align}\n",
    "\\mathbb E[m] & = N\\mu \\\\\n",
    "\\text{var}[m] & = N\\mu(1-\\mu)\n",
    "\\end{align}\n",
    "$$\n",
    "\n",
    "计算均值时考虑下式对 $\\mu$ 的导数，方差考虑对 $\\mu$ 的二阶导数： \n",
    "\n",
    "$$\n",
    "\\sum_{m=0}^N \\begin{pmatrix} N \\\\m \\end{pmatrix} \\mu^{m}(1-\\mu)^{N-m} = 1\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2.1.1 beta 分布"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "之前看到，当数据量较少时，最大似然的结果很可能会过拟合。为了减少这样的情况，从 Bayes 概率的观点出发，我们引入一个关于 $\\mu$ 的先验分布 $p(\\mu)$。\n",
    "\n",
    "我们观察到似然函数是一系列 $\\mu^x(1-\\mu)^{1-x}$ 形式的乘积，如果我们选择一个正比于 $\\mu$ 的某个幂次和 $1-\\mu$ 的某个幂次的先验分布，那么对 $\\mu$ 来说，后验分布应当满足同样的形式。这样的性质叫做共轭性（`conjugacy`）。\n",
    "\n",
    "在这里，我们引入的是 $0-1$ 间的 `beta` 分布：\n",
    "\n",
    "$$\n",
    "\\text{Beta}(\\mu~|~a,b)=\\frac{\\Gamma(a+b)}{\\Gamma(a)\\Gamma(b)} \\mu^{a-1} (1-\\mu)^{b-1}\n",
    "$$\n",
    "\n",
    "其中：\n",
    "\n",
    "$$\n",
    "\\Gamma(x) \\equiv \\int_0^{\\infty} u^{x-1}e^{-u} du\n",
    "$$\n",
    "\n",
    "满足如下性质：\n",
    "\n",
    "$$\n",
    "\\begin{align}\n",
    "\\Gamma(x+1) & = \\int_0^{\\infty} u^{x}e^{-u} du = \\left[-e^{-u}u^x\\right]_0^{\\infty} + x \\int_0^{\\infty} u^{x-1}e^{-u} du = 0 + x\\Gamma(x) = x\\Gamma(x) \\\\\n",
    "\\Gamma(1) & = \\int_0^{\\infty} e^{-u} du = \\left[-e^{-u}\\right]_0^{\\infty} = 1\n",
    "\\end{align}\n",
    "$$\n",
    "\n",
    "验证它是一个概率分布：\n",
    "\n",
    "由定义\n",
    "\n",
    "$$\n",
    "\\Gamma(a)\\Gamma(b) = \\int_0^\\infty x^{a-1}e^{-x} dx \\int_0^\\infty y^{b-1}e^{-y} dy\n",
    "$$\n",
    "\n",
    "令 $t = y + x, dt = dy$，则有：\n",
    "\n",
    "$$\n",
    "\\Gamma(a)\\Gamma(b) = \\int_0^\\infty x^{a-1} \\left\\{\\int_x^\\infty (t-x)^{b-1}e^{-t} dt \\right\\} dx \n",
    "$$\n",
    "\n",
    "交换积分次序，原来 $t$ 是从 $x$ 积分到 $\\infty$，现在 $x$ 是从 $0$ 积分到 $t$：\n",
    "\n",
    "$$\n",
    "\\Gamma(a)\\Gamma(b) = \\int_0^\\infty \\int_0^t x^{a-1} (t-x)^{b-1}e^{-t} dxdt \n",
    "$$\n",
    "\n",
    "令 $x = t\\mu, dx = td\\mu$，则有\n",
    "\n",
    "$$\n",
    "\\begin{align}\n",
    "\\Gamma(a)\\Gamma(b) & = \\int_0^\\infty e^{-t} t^{a-1} t^{b-1} tdt \\int_0^1 \\mu^{a-1} (1-\\mu)^{b-1} d\\mu \\\\\n",
    "& = \\Gamma(a + b) \\int_0^1 \\mu^{a-1} (1-\\mu)^{b-1} d\\mu\n",
    "\\end{align}\n",
    "$$\n",
    "\n",
    "于是我们有：\n",
    "\n",
    "$$\n",
    "\\int_0^1 \\text{Beta}(\\mu~|~a,b) d\\mu = 1\n",
    "$$\n",
    "\n",
    "其均值和方差为\n",
    "\n",
    "$$\n",
    "\\begin{align}\n",
    "\\mathbb E[\\mu] & = \\frac{a}{a+b} \\\\\n",
    "\\text{var}[\\mu] & = \\frac{ab}{(a+b)^2(a+b+1)}\n",
    "\\end{align}\n",
    "$$\n",
    "\n",
    "求均值：\n",
    "\n",
    "从归一化我们知道：\n",
    "\n",
    "$$\n",
    "\\int_0^1 \\mu^{a-1} (1-\\mu)^{b-1} d\\mu = \\frac{\\Gamma(a)\\Gamma(b)}{\\Gamma(a + b)}\n",
    "$$\n",
    "\n",
    "从而，利用 $\\Gamma(x+1) = x\\Gamma(x)$：\n",
    "\n",
    "$$\n",
    "\\mathbb E[\\mu] = \\frac{\\Gamma(a+b)}{\\Gamma(a)\\Gamma(b)}  \\int \\mu^{a+1-1} (1-\\mu)^{b-1} d\\mu \n",
    "= \\frac{\\Gamma(a+b)}{\\Gamma(a)\\Gamma(b)} \\frac{\\Gamma(a+1)\\Gamma(b)}{\\Gamma(a+b+1)} = \\frac{a}{a+b}\n",
    "$$\n",
    "\n",
    "类似可以得到：\n",
    "\n",
    "$$\n",
    "\\mathbb E[\\mu^2] = \\frac{\\Gamma(a+b)}{\\Gamma(a)\\Gamma(b)}  \\int \\mu^{a+2-1} (1-\\mu)^{b-1} d\\mu \n",
    "= \\frac{\\Gamma(a+b)}{\\Gamma(a)\\Gamma(b)} \\frac{\\Gamma(a+2)\\Gamma(b)}{\\Gamma(a+b+2)} = \\frac{a(a+1)}{(a+b)(a+b+1)}\n",
    "$$\n",
    "\n",
    "从而可以计算出方差。\n",
    "\n",
    "$a$ 和 $b$ 被叫做超参，因为它们控制分布的参数 $\\mu$。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAksAAAG/CAYAAABIVpOQAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl4VOXZx/HvYQmrEHaQTQUUBRHEBRA1RMAFqUpdUUSt\nCu6CtvJardhqxYq1bhSLYAVRirgrIKgERRYLFRBkRwKIbErYQk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CFUsiIiIiEfw/8RaZIdan3cIAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f4af14d2810>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from scipy.stats import beta\n",
    "\n",
    "fig, axes = plt.subplots(2, 2,figsize=(10, 7))\n",
    "\n",
    "axes = axes.flatten()\n",
    "\n",
    "A = (0.1, 1, 2, 8)\n",
    "B = (0.1, 1, 3, 4)\n",
    "\n",
    "xx = np.linspace(0, 1, 100)\n",
    "\n",
    "for a, b, ax in zip(A, B, axes):\n",
    "    yy = beta.pdf(xx, a, b)\n",
    "    ax.plot(xx, yy, 'r')\n",
    "    ax.set_ylim(0, 3)\n",
    "    \n",
    "    ax.set_xticks([0, 0.5, 1])\n",
    "    ax.set_xticklabels([\"$0$\", \"$0.5$\", \"$1$\"], fontsize=\"large\")\n",
    "    ax.set_yticks([0, 1, 2, 3])\n",
    "    ax.set_yticklabels([\"$0$\", \"$1$\", \"$2$\", \"$3$\"], fontsize=\"large\")\n",
    "    ax.set_xlabel(\"$\\mu$\", fontsize=\"x-large\")\n",
    "    \n",
    "    ax.text(0.1, 2.5, r\"$a={}$\".format(a), fontsize=\"x-large\")\n",
    "    ax.text(0.1, 2.2, r\"$b={}$\".format(b), fontsize=\"x-large\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "有了先验分布，我们的后验分布为\n",
    "\n",
    "$$\n",
    "p(\\mu~|~m,l,a,b) \\propto \\mu^{m+a+1} (1-\\mu)^{l+b-1}\n",
    "$$\n",
    "\n",
    "其中 $l = N - m$。\n",
    "\n",
    "由共轭性，我们知道后验分布还是一个 `beta` 分布，从而有\n",
    "\n",
    "$$\n",
    "p(\\mu~|~m,l,a,b) \\sim \\text{Beta}(\\mu~|~a+m, b+l)\n",
    "$$\n",
    "\n",
    "至此，我们看到，如果我们观测到了一组 $m$ 个 $x = 1$ 和 $l$ 个 $x= 0$ 的数据，那么超参由 $a, b$ 变成 $a + m, b + l$。因此，超参 $a, b$ 可以看成是 $x=1$ 和 $x=0$ 的有效观测次数（注意：$a, b$ 可以不是整数）。\n",
    "\n",
    "更进一步，当有新的数据到来时，后验概率可以看成新的先验概率，因此这个过程可以序列化进行。下图表示观测到一个新的 $x=1$ 数据时，先验到后验的变化。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAkwAAACkCAYAAABl7HEFAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xd4VNXWBvB3B0JCFUFK6KEJ5IIKAhYwQWmCBYQQkVCk\nFwFFUBGCIBIF0e9KUUBEvdKGdhEQRECaCNKRLiUYpEa8SDMMSfb3x0pCBpLMJFPOmZn39zx5IJnJ\nOTvJrDnr7LK20lqDiIiIiLIWYHQDiIiIiMyOCRMRERGRHUyYiIiIiOxgwkRERERkBxMmIiIiIjuY\nMBERERHZYTdhUkqVV0qtV0odVEodUEoN8kTDiMyKMUF0G+OB/IWyV4dJKVUaQGmt9V6lVCEAuwC0\n0Vof9kQDicyGMUF0G+OB/IXdHiat9Xmt9d7U/18DcBhAGXc3jMisGBNEtzEeyF/kaA6TUqoSgIcA\n/OKOxhB5G8YE0W2MB/JlDidMqV2tiwAMTr2LIPJrjAmi2xgP5OvyOvIkpVQggMUAZmutl97xGDej\nI1PRWit3n4MxQd7E3TGRXTykPs6YIFPJTUw4MulbAfgawCWt9WuZPK65ga/zRo8ejdGjRxvdDK+n\nlPLExYEx4QGMCddwd0zYi4fU5zAmXIAx4Rq5jQlHhuQeBxANoIlSak/qR8sct5DIdzAmiG5jPJBf\nsDskp7X+CSxwSZSOMUF0G+OB/AVf5CYRERFhdBOITIUxQWSLMWEsu3OY7B6AY9NkIp6Yw+RAGxgT\nZBqMCSJb7pzDREREROTXmDARERER2cGEiYiIi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+fLlumTJknrQoEHpjxcu\nXFj369dPHz58WB84cEBrrXVERITu1atX+nGGDh2qixcvrhctWqSPHTumY2NjdUBAgF63bl36c5RS\nunjx4nrKlCn65MmT+tixY063n8wj9fXo9OvamQ9XxETXrl11s2bNtNZav/POO7pq1arpj2X8/Pff\nf9c1atTQkZGR2mq1aq21/vLLL/W9996rZ8+erePi4vSmTZt0nTp1dOfOnW2O37Rp00yPmfZ5wYIF\n9dNPP613796t9+3bpx966CEdHh6e/px9+/bpPHny6CFDhuijR4/qVatW6QoVKticZ8qUKTp//vz6\n888/18ePH9fTpk3TwcHB+osvvkh/Tps2bXS1atX0+vXr9cGDB3V0dLQuUqRI+s9PzvGFmLB3jbD3\n3r9z506dN29e/c033+j4+Hi9f/9+/cUXX+g//vhDW61WPXXqVK2U0hcuXNAXLlzQV65c0VpLHFSs\nWFEvXbpUnzp1Sq9cuVJXqFBBx8TEpLetYsWKukiRInrMmDH62LFj+vDhw1prrStVqqTHjRuX/rz2\n7dvr0NBQ/cMPP+gjR47owYMH63z58ukjR45orbWOi4vTSildrlw5PWfOHB0XF6fj4uKc+r3p69e1\nHj5c62LFtB4zRuvUn8ulbt3SeupUre+7T+vx47VOSnL9OVwstzFheCBoLcEQGhqqU1JS0r82Y8YM\nHRQUpK9fv67Dw8P1/ffff9f3ZUyYrl+/roOCgvRnn31m85y2bdvqJ598Mv1zpZTu2bOn020mc/KF\ni4PWjiVM+/bt02XKlNGvvPKKzfdWrFhRT58+3eZrGzdu1Eopffny5fTj20uY8ubNq//888/0r82f\nP18HBATomzdvaq21jo6O1g0bNrQ5z7fffqsDAgJ0fHy81lrrcuXK6TfffNPmOa+99pquXLmy1lrr\nY8eOaaWUXrt2bfrjVqtVly1blgmTi/hCTNi7RuTLly/b9/4lS5boe+65Jz0RutM333yjU/e7S3f9\n+nVdoEABvXr1apuvf/3117po0aLpn1esWNEmltJkTJjSXuerVq2yeU7dunV19+7dtda3E6b33nsv\n29+Fw9at0zo0VOuOHbU+c8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URERGRHQ4XriQiIiLyV0yYiIiIiOxgwkRERERkBxMmIiIiIjuYMBERERHZwYSJiIiIyA4m\nTERERER2MGEiIiIisoMJExEREZEdTJgMppTqopQal+HzXkqpGCPbRGQkxgSRLcaEOTBhMt4LAHZl\n+DwSwD6D2kJkBowJIluMCRPgXnIGUkrlAXABQBWt9d9KqWAAFwGU1VpfNbZ1RJ7HmCCyxZgwD/Yw\nGasegJNa679TP28M4ACA60qpYsY1i8gwjAkiW4wJk2DCZKymAE5m+PwlAJsAPAmgtCEtIjIWY4LI\nFmPCJDgkZyCl1DoAyQDmAggEkAjgKQDbtdafGtk2IiMwJohsMSbMgwmTQVLHoc8AKK21vmV0e4iM\nxpggssWYMBcOyRmnEYC9DAKidIwJIluMCRNhwmSc2gCWGt0IIhNhTBDZYkyYCIfkiIiIiOxgDxMR\nERGRHUyYiIiIiOxgwkRERERkBxMmIiIiIjuYMBERERHZwYSJiIiIyA4mTERERER2MGEiIiIisuP/\nAZ0lT8mMg+24AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f4acb9e8550>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "xx = np.linspace(0, 1, 100)\n",
    "\n",
    "fig, axes = plt.subplots(1, 3, figsize=(10, 2))\n",
    "\n",
    "axes = axes.flatten()\n",
    "\n",
    "axes[0].plot(xx, beta.pdf(xx, 2, 2), 'r')\n",
    "axes[0].set_ylim(0, 2)\n",
    "axes[0].text(0.1, 1.6, \"prior\", fontsize=\"x-large\")\n",
    "axes[0].set_xlabel(\"$\\mu$\", fontsize=\"x-large\")\n",
    "axes[0].set_xticks([0, 0.5, 1])\n",
    "axes[0].set_yticks([0, 1, 2])\n",
    "\n",
    "axes[1].plot(xx, xx, 'b')\n",
    "axes[1].set_ylim(0, 2)\n",
    "axes[1].text(0.1, 1.6, \"likelihood\", fontsize=\"x-large\")\n",
    "axes[1].set_xlabel(\"$\\mu$\", fontsize=\"x-large\")\n",
    "axes[1].set_xticks([0, 0.5, 1])\n",
    "axes[1].set_yticks([0, 1, 2])\n",
    "\n",
    "axes[2].plot(xx, beta.pdf(xx, 3, 2), 'r')\n",
    "axes[2].set_ylim(0, 2)\n",
    "axes[2].text(0.1, 1.6, \"posterior\", fontsize=\"x-large\")\n",
    "axes[2].set_xlabel(\"$\\mu$\", fontsize=\"x-large\")\n",
    "axes[2].set_xticks([0, 0.5, 1])\n",
    "axes[2].set_yticks([0, 1, 2])\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "如果我们的目的是预测下一次实验的结果，那么我们有\n",
    "\n",
    "$$\n",
    "p(x=1|\\mathcal D) = \\int_{0}^1 p(x=1|\\mu) p(\\mu|\\mathcal D) d\\mu=\n",
    "\\int_0^1 \\mu p(\\mu|\\mathcal D) = \\mathbb E[\\mu|\\mathcal D]\n",
    "$$\n",
    "\n",
    "而我们知道后验概率的分布，所以可以计算出其均值：\n",
    "\n",
    "$$\n",
    "p(x=1|\\mathcal D) = \\frac{m+a}{m+a+l+b} = \\frac{m+a}{N+a+b}\n",
    "$$\n",
    "\n",
    "当 $m, l \\to \\infty$ 时，有\n",
    "\n",
    "$$\n",
    "p(x=1|\\mathcal D) = \\frac{m+a}{m+a+l+b} = \\frac{m+a}{N+a+b} \\to \\frac{m}{N}\n",
    "$$\n",
    "\n",
    "即趋向于最大似然的解。当 $N$ 有限时，我们的解总在先验均值和最大似然解之间。\n",
    "\n",
    "另外我们观察到，随着 $(a,b)$ 的增加，函数分布变得越来越尖，即方差越来越小。事实上，随着观测数据的增加，我们对于后验分布的不确定性也在不断减小。\n",
    "\n",
    "另外考虑条件期望和方差的性质，我们有：\n",
    "\n",
    "$$\n",
    "\\mathbb E_\\mathbf\\theta[\\mathbf\\theta] = \\mathbb E_\\mathcal{D}[\\mathbb E_\\mathbf\\theta[\\mathbf\\theta|\\mathcal D]]\n",
    "$$\n",
    "\n",
    "和\n",
    "\n",
    "$$\n",
    "\\text{var}_\\mathbf\\theta[\\mathbf\\theta] = \\mathbb E_\\mathcal{D}[\\text{var}_\\mathbf\\theta[\\mathbf\\theta|\\mathcal D]] + \\text{var}_\\mathcal{D}[\\mathbb E_\\mathbf\\theta[\\mathbf\\theta|\\mathcal D]]\n",
    "$$\n",
    "\n",
    "从而我们知道，从平均意义上来说，后验分布的方差要比先验分布的方差要小。后验分布在数据分布上的均值等于先验分布的均值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
